class Solution {
    public int findTheLongestSubstring(String s) {
        HashMap<Integer,Integer> map = new HashMap<>();
        int state = 0;
        int maxlen = 0;
        map.put(0, -1);
        // a b c x y z 分别在第123456个bit，来表示出现次数的奇偶性
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'a') state ^= 0x000001;
            if (s.charAt(i) == 'e') state ^= 0x000010;
            if (s.charAt(i) == 'i') state ^= 0x000100;
            if (s.charAt(i) == 'o') state ^= 0x001000;
            if (s.charAt(i) == 'u') state ^= 0x010000;

            if (map.containsKey(state)) {
                maxlen = Math.max(maxlen, i - map.get(state));
            } else {
                map.put(state, i);
            }
        }
        return maxlen;
    }
}